<template>
   <div class="firstdemo">
     <el-form ref="form" :model="form" label-width="80px">
       <el-row type="flex" justify="center">
         <el-col :span="5">
            <el-form-item label="用户名">
                <el-input v-model="form.name"></el-input>
            </el-form-item>
         </el-col>
       </el-row>
       <el-row type="flex" justify="center">
         <el-col :span="5">
            <el-form-item label="密  码">
              <el-input v-model="form.password"></el-input>
            </el-form-item>
         </el-col>
       </el-row> 
       <el-row type="flex" justify="center">
         <el-col :span="5">
            <el-form-item>
              <el-button type="primary" @click="onSubmit">登录</el-button>
              <el-button>注册</el-button>
            </el-form-item>
         </el-col>
       </el-row>
     </el-form>
   </div>
</template>
<script>
export default {
   name: "fisrtdemo",
   data() {
       return {
           form: {
               name: "",
               password: ""
           }
       };
   },
   methods: {
     onSubmit() {
       if (this.form.name == "邵文杰" && this.form.password == "902124") {
         this.$message({
            message: '登录成功',
            type: 'success'
           }); 
           this.$router.push({ path: "/Home" });
         }else{
            this.$message.error('登录失败');
         }
     }
   }
};
</script>
<style lang="stylus" scoped></style>